package Service;


import Config.GlobalVariables;
import Entity.InboundCounter;
import Entity.OutboundCounter;
import Entity.Products;

import java.util.List;
import java.util.Random;

public class RandomProductDelivery {
    // TODO: 实现随机产品的功能实现
    private static final List<String> PRODUCT_NAMES = List.of("ProductA", "ProductB", "ProductC", "ProductD");
    private static final List<String> CATEGORIES = List.of("Electronics", "Furniture", "Clothing", "Toys");
    private static final int MAX_GROUP_ID = 10; // 最大组标识符
    private static final int MAX_STOCK = 50; // 最大库存数量
    private static final int MAX_X = 100; // 最大 X 坐标值
    private static final int MAX_Y = 100; // 最大 Y 坐标值
    private static final Random RANDOM = new Random();
    private static final List<InboundCounter> COUNTERS = List.of(
            GlobalVariables.inboundCounter1, GlobalVariables.inboundCounter2,
            GlobalVariables.inboundCounter3, GlobalVariables.inboundCounter4);
    // 随机生成产品
    public static Products generateProduct() {
        String name = PRODUCT_NAMES.get(RANDOM.nextInt(PRODUCT_NAMES.size()));
        String category = CATEGORIES.get(RANDOM.nextInt(CATEGORIES.size()));
        int groupId = RANDOM.nextInt(MAX_GROUP_ID) + 1; // 生成 1 到 MAX_GROUP_ID 的组标识符
        int stock = RANDOM.nextInt(MAX_STOCK) + 1; // 随机库存数量
        int x = RANDOM.nextInt(MAX_X); // 随机生成产品的 X 坐标
        int y = RANDOM.nextInt(MAX_Y); // 随机生成产品的 Y 坐标
        InboundCounter counter = COUNTERS.get(RANDOM.nextInt(COUNTERS.size()));
        // 创建并返回一个新的 Products 对象
        return new Products(name, RANDOM.nextInt(1000), category, groupId, 1, x, y,counter);
    }
}

